package org.cytoscape.cytargetlinker.internal.util;
// CyTargetLinker,
// a Cytoscape plugin to extend biological networks with regulatory interaction
// Copyright 2011-2012 BiGCaT Bioinformatics
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//


import java.awt.Color;
import java.util.ArrayList;
import java.util.List;

/**
 * stores global preferences
 */
public class Preferences {
	
	private static Preferences instance;
	
	public String vsName = "CyTargetLinker Visual Style";
	public String nodeTypeAttribute = "NodeType";
	
	public String networkNodeValue = "NetworkNode";
	public String newNodeValue = "NewNode";
	public String groupNodeValue = "GroupNode";

	private List<Color> colors;

	
	private Preferences() {
		colors = new ArrayList<Color>();
		calcColors(10);
	}

	/**
	 * currently we only support up to 10 RINs
	 * this should not be hardcoded!
	 * improve: find distinct colors for as many RINs as possible
	 */
	public void calcColors(int x) {
		// blue
		Color c = new Color(31, 120, 180);
		colors.add(c);
		// red
		c = new Color(227, 26, 28);
		colors.add(c);
		// violet
		c = new Color(106, 61, 154);
		colors.add(c);
		// orange
		c = new Color(255, 127, 0);
		colors.add(c);
		// green
		c = new Color(51, 160, 44);
		colors.add(c);
		
		// light blue
		c = new Color(166, 206, 227);
		colors.add(c);
		// light red
		c = new Color(251, 154, 153);
		colors.add(c);
		// light violet
		c = new Color(202, 178, 214);
		colors.add(c);
		// yellow
		c = new Color(253, 191, 111);
		colors.add(c);
		// light green
		c = new Color(178, 223, 138);
		colors.add(c);
		
		
	}
	
	public static Preferences getInstance() {
		if (instance == null) {
            instance = new Preferences();
        }
        return instance;
	}

	public List<Color> getColors() {
		return colors;
	}
	
	public void setColors(List<Color> colors) {
		this.colors = colors;
	}

	public String getVsName() {
		return vsName;
	}

	public void setVsName(String vsName) {
		this.vsName = vsName;
	}

	public String getNodeTypeAttribute() {
		return nodeTypeAttribute;
	}

	public void setNodeTypeAttribute(String nodeTypeAttribute) {
		this.nodeTypeAttribute = nodeTypeAttribute;
	}

	public String getNetworkNodeValue() {
		return networkNodeValue;
	}

	public void setNetworkNodeValue(String networkNodeValue) {
		this.networkNodeValue = networkNodeValue;
	}

	public String getNewNodeValue() {
		return newNodeValue;
	}

	public void setNewNodeValue(String newNodeValue) {
		this.newNodeValue = newNodeValue;
	}

	public String getGroupNodeValue() {
		return groupNodeValue;
	}

	public void setGroupNodeValue(String groupNodeValue) {
		this.groupNodeValue = groupNodeValue;
	}
}
